<html>
 <head>
  <meta charset="utf-8"/>
  <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport"/>
  <title>
   主题：《纸牌屋》第二季twitter消息分析(R语言)  | 数螺 | NAUT IDEA
  </title>
  <link href="http://cdn.bootcss.com/bootstrap/3.3.6/css/bootstrap-theme.min.css" rel="stylesheet"/>
  <link href="http://cdn.bootcss.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet"/>
  <style type="text/css">
   #xmain img {
                  max-width: 100%;
                  display: block;
                  margin-top: 10px;
                  margin-bottom: 10px;
                }

                #xmain p {
                    line-height:150%;
                    font-size: 16px;
                    margin-top: 20px;
                }

                #xmain h2 {
                    font-size: 24px;
                }

                #xmain h3 {
                    font-size: 20px;
                }

                #xmain h4 {
                    font-size: 18px;
                }


                .header {
	           background-color: #0099ff;
	           color: #ffffff;
	           margin-bottom: 20px;
	        }

	        .header p {
                  margin: 0px;
                  padding: 10px 0;
                  display: inline-block;  
                  vertical-align: middle;
                  font-size: 16px;
               }

               .header a {
                 color: white;
               }

              .header img {
                 height: 25px;
              }
  </style>
  <script src="http://cdn.bootcss.com/jquery/3.0.0/jquery.min.js">
  </script>
  <script src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript">
   MathJax.Hub.Config({elements: ["bbpress-forums"]});
  </script>
  <script src="http://nautstatic-10007657.file.myqcloud.com/static/css/readability.min.js" type="text/javascript">
  </script>
  <script type="text/javascript">
   $(document).ready(function() {
                 var loc = document.location;
                 var uri = {
                  spec: "http://cos.name/cn/topic/150580/",
                  host: "http://cos.name",
                  prePath: "http://cos.name",
                  scheme: "http",
                  pathBase: "http://cos.name/"
                 };
    
                 var documentClone = document.cloneNode(true);
                 var article = new Readability(uri, documentClone).parse();
     
                 document.getElementById("xmain").innerHTML = article.content;
                });
  </script>
  <!-- 1466440660: Accept with keywords: (title(0.166666666667):纸牌,屋,主题,R语言,消息,论坛, topn(0.3):数字,散点图,帖子,R语言,分布,会员,消极,文件,用户名,主站,有意思,向量,讨论区,函数,账户,论坛,矩阵,楼主,普通,随机,整理,词汇,右图,纸牌,主题,单词,消息,聚类,文本,标点符号).-->
 </head>
 <body class="topic bbpress single single-topic postid-150580 single-author sidebar" onload="">
  <div class="header">
   <div class="container">
    <div class="row">
     <div class="col-xs-6 col-sm-6 text-left">
      <a href="/databee">
       <img src="http://nautidea-10007657.cos.myqcloud.com/logo_white.png"/>
      </a>
      <a href="/databee">
       <p>
        数螺
       </p>
      </a>
     </div>
     <div class="hidden-xs col-sm-6 text-right">
      <p>
       致力于数据科学的推广和知识传播
      </p>
     </div>
    </div>
   </div>
  </div>
  <div class="container text-center">
   <h1>
    主题：《纸牌屋》第二季twitter消息分析(R语言)
   </h1>
  </div>
  <div class="container" id="xmain">
   <div class="hfeed site" id="page">
    <header class="site-header" id="masthead" role="banner">
     <div id="cos-logo">
      <a href="http://cos.name/cn">
       <img src="http://cos.name/cn/wp-content/themes/COS-forest/images/headers/cos-logo.png"/>
      </a>
     </div>
     <div class="navbar" id="navbar">
      <nav class="navigation main-navigation" id="site-navigation" role="navigation">
       <h3 class="menu-toggle">
        菜单
       </h3>
       <div class="menu-%e8%8f%9c%e5%8d%951-container">
        <ul class="nav-menu" id="menu-%e8%8f%9c%e5%8d%951">
         <li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-home menu-item-407772" id="menu-item-407772">
          <a href="http://cos.name/cn/">
           论坛首页
          </a>
         </li>
         <li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-407773" id="menu-item-407773">
          <a href="http://cos.name/cn/forums/">
           讨论区
          </a>
         </li>
         <li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-407774" id="menu-item-407774">
          <a href="http://cos.name/cn/wp-login.php?action=register">
           注册
          </a>
         </li>
         <li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-407819" id="menu-item-407819">
          <a href="http://cos.name/">
           主站
          </a>
         </li>
        </ul>
       </div>
      </nav>
      <!-- #site-navigation -->
     </div>
     <!-- #navbar -->
    </header>
    <!-- #masthead -->
    <div class="site-main" id="main">
     <div class="content-area" id="primary">
      <div class="site-content" id="content" role="main">
       <article class="post-150580 topic type-topic status-publish hentry" id="post-150580">
        <header class="entry-header">
         <h1 class="entry-title">
          《纸牌屋》第二季twitter消息分析(R语言)
         </h1>
        </header>
        <!-- .entry-header -->
        <div class="entry-content">
         <div id="bbpress-forums">
          <div class="bbp-breadcrumb">
           <p>
            <a class="bbp-breadcrumb-home" href="http://cos.name/cn/">
             COS论坛 | 统计之都
            </a>
            <span class="bbp-breadcrumb-sep">
             ›
            </span>
            <a class="bbp-breadcrumb-root" href="http://cos.name/cn/forums/">
             讨论区
            </a>
            <span class="bbp-breadcrumb-sep">
             ›
            </span>
            <a class="bbp-breadcrumb-forum" href="http://cos.name/cn/forum/software/">
             软件应用
            </a>
            <span class="bbp-breadcrumb-sep">
             ›
            </span>
            <a class="bbp-breadcrumb-forum" href="http://cos.name/cn/forum/software/r-language/">
             S-Plus &amp; R语言
            </a>
            <span class="bbp-breadcrumb-sep">
             ›
            </span>
            <span class="bbp-breadcrumb-current">
             《纸牌屋》第二季twitter消息分析(R语言)
            </span>
           </p>
          </div>
          <div class="bbp-template-notice info">
           <p class="bbp-topic-description">
            该主题包含 16 条回复，12个帖子，最后由
            <a class="bbp-author-avatar" href="http://cos.name/cn/profile/390322/" rel="nofollow" title="查看kehqkim的档案">
             <img src="http://sdn.geekzu.org/avatar/69744b588040d46889125bc4d049abc6?s=14&amp;d=monsterid&amp;r=g"/>
            </a>
            <a class="bbp-author-name" href="http://cos.name/cn/profile/390322/" rel="nofollow" title="查看kehqkim的档案">
             kehqkim
            </a>
            在
            <a href="http://cos.name/cn/topic/150580/page/2/#post-403702" title="回复：《纸牌屋》第二季twitter消息分析(R语言)">
             1 年, 11 月 之前
            </a>
            更新。
           </p>
          </div>
          <div class="bbp-pagination">
           <div class="bbp-pagination-count">
            查看 15 个帖子 - 1 到 15（总计 17 个）
           </div>
           <div class="bbp-pagination-links">
            <span class="page-numbers current">
             1
            </span>
            <a class="page-numbers" href="http://cos.name/cn/topic/150580/page/2/">
             2
            </a>
            <a class="next page-numbers" href="http://cos.name/cn/topic/150580/page/2/">
             →
            </a>
           </div>
          </div>
          <ul class="forums bbp-replies" id="topic-150580-replies">
           <li class="bbp-header">
            <div class="bbp-reply-author">
             作者
            </div>
            <!-- .bbp-reply-author -->
            <div class="bbp-reply-content">
             帖子
            </div>
            <!-- .bbp-reply-content -->
           </li>
           <!-- .bbp-header -->
           <li class="bbp-body">
            <div class="bbp-reply-header" id="post-150580">
             <div class="bbp-meta">
              <span class="bbp-reply-post-date">
               2014年2月15日 上午7:56
              </span>
              <a class="bbp-reply-permalink" href="http://cos.name/cn/topic/150580/#post-150580">
               1 楼
              </a>
              <span class="bbp-admin-links">
              </span>
             </div>
             <!-- .bbp-meta -->
            </div>
            <!-- #post-150580 -->
            <div class="odd bbp-parent-forum-999 bbp-parent-topic-150580 bbp-reply-position-1 user-id-384036 topic-author post-150580 topic type-topic status-publish hentry">
             <div class="bbp-reply-author">
              <a class="bbp-author-avatar" href="http://cos.name/cn/profile/384036/" rel="nofollow" title="查看野蛮人的档案">
               <img src="http://sdn.geekzu.org/avatar/133345d351988b5794ec0c88a6d6565e?s=80&amp;d=monsterid&amp;r=g"/>
              </a>
              <br/>
              <a class="bbp-author-name" href="http://cos.name/cn/profile/384036/" rel="nofollow" title="查看野蛮人的档案">
               野蛮人
              </a>
              <br/>
              <div class="bbp-author-role">
               普通会员
              </div>
             </div>
             <!-- .bbp-reply-author -->
             <div class="bbp-reply-content">
              <p>
               作为资深美剧迷，《纸牌屋》这种神剧当然是不会错过的，尤其是Netflix将第二季的13集一起发布，更是让小伙伴们乐坏了。刚好最近在学习数据挖掘方面的知识，觉得用来分析twitter上关于《纸牌屋》第二季消息会非常有意思，当然由于自身技术能力有限，抱着交流学习的目的，所谓的分析只能蜻蜓点水、一笔带过，没啥技术含量，还望有大神能够指点一二，万分感谢！
               <br/>
               1 获取Twitter信息
               <br/>
               请现在Twitter Developer网站注册账户，然后创建application，获得consumerKey和consumerSecret，替换下面”your_key”和”your_secret”。
              </p>
              <pre class="highlight ">require(twitteR)  ##R中Twitter的api包
download.file(url="http://curl.haxx.se/ca/cacert.pem", destfile="cacert.pem")
requestURL &lt;- "https://api.twitter.com/oauth/request_token"
accessURL = "https://api.twitter.com/oauth/access_token"
authURL = "https://api.twitter.com/oauth/authorize"
consumerKey = "your_key"
consumerSecret = "your_secret"
Cred &lt;- OAuthFactory$new(consumerKey=consumerKey,
                         consumerSecret=consumerSecret,
                         requestURL=requestURL,
                         accessURL=accessURL,
                         authURL=authURL)
Cred$handshake(cainfo = system.file("CurlSSL", "cacert.pem", package = "RCurl"))
</pre>
              <p>
               这时会提示一个网址，用浏览器打开后获得PIN码，输入到R命令行回车。
              </p>
              <pre class="highlight ">&gt; registerTwitterOAuth(Cred)
[1] TRUE 	 ##表示注册成功，可以进行Twitter搜索了。
&gt; house.cards &lt;- searchTwitter("house of cards season 2", n = 1500, cainfo="cacert.pem")
Warning message:
In doRppAPICall("search/tweets", n, params = params, retryOnRateLimit = retryOnRateLimit,  :
  1500 tweets were requested but the API can only return 799
&gt; length(house.cards)
[1] 799
&gt; class(house.cards)
[1] "list"
</pre>
              <p>
               只返回799条信息，没关系不影响下面的分析过程，先简单看下前三条信息
              </p>
              <pre class="highlight ">&gt; head( house.cards, n = 3)
[[1]]
[1] "TimmzVandercamp: House of Cards Season 2 is everything!"
[[2]]
[1] "omnicious: Hm so Netflix apparently released season 2 of House of Cards. Guess I'm not going to be productive for the next few days."
[[3]]
[1] "mandyy_L: Photo: houseofcards: Behind every great man is a woman with blood on her hands. House of Cards Season 2... &lt;a href="http://t.co/EO0zM4ciXM" rel="nofollow"&gt;http://t.co/EO0zM4ciXM&lt;/a&gt;"
</pre>
              <p>
               2 消息文本处理
               <br/>
               考虑到list不便于后面的分析，需要将其转换为文本向量，这时用到plyr包的laply函数，注意和lapply是不同的，lapply返回的是list类型，然后可以将消息文本保存在文件中。
              </p>
              <pre class="highlight ">&gt; library(plyr)
&gt; cards.text &lt;- laply(house.cards, function(x) x$getText())
&gt; length(cards.text)
[1] 799
&gt; head(cards.text)
[1] "House of Cards Season 2 is everything!"
[2] "Hm so Netflix apparently released season 2 of House of Cards. Guess I'm not going to be productive for the next few days."
[3] "Photo: houseofcards: Behind every great man is a woman with blood on her hands. House of Cards Season 2... &lt;a href="http://t.co/EO0zM4ciXM" rel="nofollow"&gt;http://t.co/EO0zM4ciXM&lt;/a&gt;"
&gt;write(cards.text, "House_Cards_Tweets799.txt", ncolumns = 1)##将tweets保存在文件中
</pre>
              <p>
              </p>
              <p>
               3 消息语义分析
               <br/>
               这里只是简单的依据消息中消极和积极的词汇个数来打分，score  =  n(pos)  –  n(neg)，比如，”I hate house of cards season 2”出现了1个neg单词，0个pos单词，那得分就为-1，那么该如何判断是否属于消极或者积极的单词呢？可以参考http://www.cs.uic.edu/~liub/FBS/sentiment-analysis.html整理的积极和消极词汇。对应的两个文件为：positive-words.txt和negative-words.txt。[2]
               <br/>
               建立积极和消极单词向量，这时便可以用到scan函数
              </p>
              <pre class="highlight ">&gt; pos.word &lt;- scan("positive-words.txt", what = character(), comment.char = ";")
&gt; neg.word &lt;- scan("negative-words.txt", what = character(), comment.char = ";")
</pre>
              <p>
               根据前面提到的打分原则，编写打分函数score.sentiment
              </p>
              <pre class="highlight ">score.sentiment &lt;- function(mes.vec, pos.word, neg.word)
{
	mes.clean &lt;- gsub("[[:punct:]]", " ", mes.vec)   ##去掉标点符号
	mes.clean &lt;- gsub("[[:cntrl:]]", "", mes.clean)	##去掉控制字符
	mes.clean &lt;- gsub("\\d+", "", mes.clean)	##去掉数字,\d+可以匹配连续的数字
	mes.clean &lt;- tolower(mes.clean)			##全部转换为小写字母
	mes.lst &lt;- strsplit(mes.clean, " ")  ##将句子分离成单个单词
	##这里一定要注意，因为句子中可能出现重复的消极或者积极词汇，如出现3个hate，这时的neg.pos应该为3，而不是1，
	##如果用intersect，不会统计重复的单词，因此需用match处理，然后去掉NA项
	score.pos &lt;- sapply(mes.lst, function(x) sum(!is.na(match(x, pos.word))))
	score.neg &lt;- sapply(mes.lst, function(x) sum(!is.na(match(x, neg.word))))
	score.df &lt;- data.frame(score = score.pos - score.neg, message = mes.vec, stringsAsFactors = F)
	return (score.df)
}
</pre>
              <p>
               对twitter消息进行打分，简单看前三条消息的分数
              </p>
              <pre class="highlight ">&gt; tweet.scores &lt;- score.sentiment(cards.text, pos.word, neg.word)
&gt; head(tweet.scores)
  score        message
1     0      House of Cards Season 2 is everything!
2     1      Hm so Netflix apparently released season 2 of House of Cards. Guess I'm not going to be productive for the next few days.
3     1      Photo: houseofcards: Behind every great man is a woman with blood on her hands. House of Cards Season 2... &lt;a href="http://t.co/EO0zM4ciXM" rel="nofollow"&gt;http://t.co/EO0zM4ciXM&lt;/a&gt;
</pre>
              <p>
               4  倾向分析
               <br/>
               Score &gt;= 2表示positive , Score =&lt; -2表示negative，其余表示Neutral。
              </p>
              <pre class="highlight ">&gt;attach(tweet.scores)
&gt;tweet.scores$trend &lt;- ifelse(score &gt;= 2, 1, ifelse(score &lt;= -2, -1, 0))
&gt;tweet.scores &lt;- transform(tweet.scores, trend =   ##将倾向转换为因子
		factor(trend, levels = c(-1, 0, 1), labels = c("neg", "neu", "pos")))
##查看比例各种态度的比例
&gt;prop.table(table(trend))
trend
        -1          0          1
0.02753442 0.92365457 0.04881101
&gt;detach(tweet.scores)
</pre>
              <p>
               从概率上看，提到纸牌屋第二季的消息中绝大部分是没有明确的表明自己的厌恶，或许只是表达可对该片的关注，不过对该片表示好感消息数量差不多是没有好感的两倍，由于没有和其它电视剧进行对比，并且消息的样本数量也较小，因此这些结论没有实际的意义。不过从另外一方面说，一般只有自己感兴趣和喜爱的电视剧，才会在消息中提到。
              </p>
              <pre class="highlight ">&gt; library(ggplot2)
&gt; ggplot(tweet.scores, aes(x = trend)) + geom_histogram()
</pre>
              <p>
              </p>
              <p>
               5 消息的分布
               <br/>
               这节将借助奇异值分解对消息的分布进行简单分析，计算出前两列最能代表的Text-Text矩阵的特征向量，将高维降低到二维并且作出散点图，观察消息是否呈现模型的聚类情况。
               <br/>
               首先利用tm包对文本向量进行简单的处理，去掉停止词、去掉数字、去掉标点符号等等，然后建立Document-Term矩阵。
              </p>
              <pre class="highlight ">&gt; tweetCorpus &lt;- tm_map(tweetCorpus, removePunctuation)  ##去掉标点符号
&gt; tweetCorpus &lt;- tm_map(tweetCorpus, removeNumbers)      ##去掉数字
&gt; tweetCorpus &lt;- tm_map(tweetCorpus, removeWords, stopwords()) ##去掉停止词
&gt; tweetCorpus &lt;- tm_map(tweetCorpus, tolower)  ##转换为小写
&gt; removeKeywords &lt;- function(x) gsub("house of cards season 2", "", x)
&gt; tweetCorpus &lt;- tm_map(tweetCorpus, removeKeywords) ##去掉关键词
&gt; tweetCorpus &lt;- tm_map(tweetCorpus, stemDocument)  ##单词主干化
&gt; tweeet.dtm &lt;- DocumentTermMatrix(tweetCorpus, control = list(minDocFreq = 3))
&gt; str(tweeet.dtm)
List of 6
 $ i       : int [1:6906] 1 1 1 1 2 2 2 2 2 2 ...
 $ j       : int [1:6906] 196 394 592 1156 62 196 287 529 592 938 ...
 $ v       : num [1:6906] 1 1 1 1 1 1 1 1 1 1 ...
 $ nrow    : int 799
 $ ncol    : int 1590
</pre>
              <p>
               接下来转换成矩阵，用奇异值分解计算前两列的左奇异向量。
              </p>
              <pre class="highlight ">&gt; tweet.matrix &lt;- as.matrix(tweeet.dtm)
&gt; tweet.svd &lt;- svd(tweet.matrix, nu = 2, nv = 2) ##取前两列的奇异向量
&gt; head(tweet.svd$u, n  = 3 )
            [,1]        [,2]
[1,] -0.03439396 0.019812393
[2,] -0.03663379 0.035717052
[3,] -0.03550512 0.021099786
</pre>
              <p>
               将左奇异向量和消息的倾向列绑定，然后做散点图查看消息的分布
              </p>
              <pre class="highlight ">&gt; tweet.u2 &lt;- data.frame(tweet.svd$u, trend = tweet.scores$trend)
&gt; colnames(tweet.u2) &lt;- c("u1", "u2", "trend")
&gt; head(tweet.u2)
           X1          X2 		trend
1 -0.03439396 0.019812393   neu
2 -0.03663379 0.035717052   neu
3 -0.03550512 0.021099786   neu
&gt; ggplot(data.frame(tweet.u2), aes(x = u1, y = u2)) + ##左图
+ geom_point(aes(col = trend), position = "jitter")
&gt; ggplot(data.frame(tweet.u2), aes(x = u1, y = u2)) + ##右图
+ geom_point(aes(col = trend), alpha = 1/10)
</pre>
              <p>
               可以明显观察到，消息主要分布在两个区域，形成两个明显的聚类，而倾向性很强的消息并没有呈现什么规律，随机分布在整个区域中，因此根据消息中积极或者消极的单词数量的规则进行聚类并没有很强的理论依据。
              </p>
              <p>
               6 参考资料
              </p>
              <pre class="highlight ">[1] &lt;a href="http://diggdata.in/post/50938118301/fetching-twitter-data-in-r-with-oauth-handshake-feature" rel="nofollow"&gt;http://diggdata.in/post/50938118301/fetching-twitter-data-in-r-with-oauth-handshake-feature&lt;/a&gt;
[2] &lt;a href="https://sites.google.com/site/miningtwitter/questions/sentiment/analysis" rel="nofollow"&gt;https://sites.google.com/site/miningtwitter/questions/sentiment/analysis&lt;/a&gt;
[3] &lt;a href="http://www.cs.uic.edu/~liub/FBS/sentiment-analysis.html" rel="nofollow"&gt;http://www.cs.uic.edu/~liub/FBS/sentiment-analysis.html&lt;/a&gt;
[4] &lt;a href="http://web.mit.edu/be.400/www/SVD/Singular_Value_Decomposition.htm" rel="nofollow"&gt;http://web.mit.edu/be.400/www/SVD/Singular_Value_Decomposition.htm&lt;/a&gt;
</pre>
              <p>
              </p>
             </div>
             <!-- .bbp-reply-content -->
            </div>
            <!-- .reply -->
            <div class="bbp-reply-header" id="post-394820">
             <div class="bbp-meta">
              <span class="bbp-reply-post-date">
               2014年2月15日 上午8:24
              </span>
              <a class="bbp-reply-permalink" href="http://cos.name/cn/topic/150580/#post-394820">
               2 楼
              </a>
              <span class="bbp-admin-links">
              </span>
             </div>
             <!-- .bbp-meta -->
            </div>
            <!-- #post-394820 -->
            <div class="even bbp-parent-forum-999 bbp-parent-topic-150580 bbp-reply-position-2 user-id-82234 post-394820 reply type-reply status-publish hentry">
             <div class="bbp-reply-author">
              <a class="bbp-author-avatar" href="http://cos.name/cn/profile/82234/" rel="nofollow" title="查看bigknife的档案">
               <img src="http://sdn.geekzu.org/avatar/2d96292d60000df78116dd2e7169da19?s=80&amp;d=monsterid&amp;r=g"/>
              </a>
              <br/>
              <a class="bbp-author-name" href="http://cos.name/cn/profile/82234/" rel="nofollow" title="查看bigknife的档案">
               bigknife
              </a>
              <br/>
              <div class="bbp-author-role">
               普通会员
              </div>
             </div>
             <!-- .bbp-reply-author -->
             <div class="bbp-reply-content">
              <p>
               回复 第1楼 的 angel_man：整理一下上主站吧。[s:11]
              </p>
             </div>
             <!-- .bbp-reply-content -->
            </div>
            <!-- .reply -->
            <div class="bbp-reply-header" id="post-394831">
             <div class="bbp-meta">
              <span class="bbp-reply-post-date">
               2014年2月15日 上午9:48
              </span>
              <a class="bbp-reply-permalink" href="http://cos.name/cn/topic/150580/#post-394831">
               3 楼
              </a>
              <span class="bbp-admin-links">
              </span>
             </div>
             <!-- .bbp-meta -->
            </div>
            <!-- #post-394831 -->
            <div class="odd bbp-parent-forum-999 bbp-parent-topic-150580 bbp-reply-position-3 user-id-383203 post-394831 reply type-reply status-publish hentry">
             <div class="bbp-reply-author">
              <a class="bbp-author-avatar" href="http://cos.name/cn/profile/383203/" rel="nofollow" title="查看mengchen的档案">
               <img src="http://sdn.geekzu.org/avatar/e31607386ca086e18d99194923fe0552?s=80&amp;d=monsterid&amp;r=g"/>
              </a>
              <br/>
              <a class="bbp-author-name" href="http://cos.name/cn/profile/383203/" rel="nofollow" title="查看mengchen的档案">
               mengchen
              </a>
              <br/>
              <div class="bbp-author-role">
               普通会员
              </div>
             </div>
             <!-- .bbp-reply-author -->
             <div class="bbp-reply-content">
              <p>
               [s:15][s:15][s:15]看着挺不错，不过麻烦用一下
              </p>
              <pre class="highlight "> </pre>
              <p>
               把代码高亮一下吧 [s:11]
              </p>
             </div>
             <!-- .bbp-reply-content -->
            </div>
            <!-- .reply -->
            <div class="bbp-reply-header" id="post-394842">
             <div class="bbp-meta">
              <span class="bbp-reply-post-date">
               2014年2月15日 下午2:00
              </span>
              <a class="bbp-reply-permalink" href="http://cos.name/cn/topic/150580/#post-394842">
               4 楼
              </a>
              <span class="bbp-admin-links">
              </span>
             </div>
             <!-- .bbp-meta -->
            </div>
            <!-- #post-394842 -->
            <div class="even bbp-parent-forum-999 bbp-parent-topic-150580 bbp-reply-position-4 user-id-384036 topic-author post-394842 reply type-reply status-publish hentry">
             <div class="bbp-reply-author">
              <a class="bbp-author-avatar" href="http://cos.name/cn/profile/384036/" rel="nofollow" title="查看野蛮人的档案">
               <img src="http://sdn.geekzu.org/avatar/133345d351988b5794ec0c88a6d6565e?s=80&amp;d=monsterid&amp;r=g"/>
              </a>
              <br/>
              <a class="bbp-author-name" href="http://cos.name/cn/profile/384036/" rel="nofollow" title="查看野蛮人的档案">
               野蛮人
              </a>
              <br/>
              <div class="bbp-author-role">
               普通会员
              </div>
             </div>
             <!-- .bbp-reply-author -->
             <div class="bbp-reply-content">
              <p>
               回复 第3楼 的 mengchen：谢谢提醒，已经高亮了
              </p>
             </div>
             <!-- .bbp-reply-content -->
            </div>
            <!-- .reply -->
            <div class="bbp-reply-header" id="post-394843">
             <div class="bbp-meta">
              <span class="bbp-reply-post-date">
               2014年2月15日 下午2:01
              </span>
              <a class="bbp-reply-permalink" href="http://cos.name/cn/topic/150580/#post-394843">
               5 楼
              </a>
              <span class="bbp-admin-links">
              </span>
             </div>
             <!-- .bbp-meta -->
            </div>
            <!-- #post-394843 -->
            <div class="odd bbp-parent-forum-999 bbp-parent-topic-150580 bbp-reply-position-5 user-id-384036 topic-author post-394843 reply type-reply status-publish hentry">
             <div class="bbp-reply-author">
              <a class="bbp-author-avatar" href="http://cos.name/cn/profile/384036/" rel="nofollow" title="查看野蛮人的档案">
               <img src="http://sdn.geekzu.org/avatar/133345d351988b5794ec0c88a6d6565e?s=80&amp;d=monsterid&amp;r=g"/>
              </a>
              <br/>
              <a class="bbp-author-name" href="http://cos.name/cn/profile/384036/" rel="nofollow" title="查看野蛮人的档案">
               野蛮人
              </a>
              <br/>
              <div class="bbp-author-role">
               普通会员
              </div>
             </div>
             <!-- .bbp-reply-author -->
             <div class="bbp-reply-content">
              <p>
               回复 第2楼 的 bigknife：初来乍到，不知道怎么操作，知道怎么贴图片吗？
              </p>
             </div>
             <!-- .bbp-reply-content -->
            </div>
            <!-- .reply -->
            <div class="bbp-reply-header" id="post-394855">
             <div class="bbp-meta">
              <span class="bbp-reply-post-date">
               2014年2月16日 上午1:50
              </span>
              <a class="bbp-reply-permalink" href="http://cos.name/cn/topic/150580/#post-394855">
               6 楼
              </a>
              <span class="bbp-admin-links">
              </span>
             </div>
             <!-- .bbp-meta -->
            </div>
            <!-- #post-394855 -->
            <div class="even bbp-parent-forum-999 bbp-parent-topic-150580 bbp-reply-position-6 user-id-13526 post-394855 reply type-reply status-publish hentry">
             <div class="bbp-reply-author">
              <a class="bbp-author-avatar" href="http://cos.name/cn/profile/13526/" rel="nofollow" title="查看cloud wei的档案">
               <img src="http://sdn.geekzu.org/avatar/c756f0debd02bd11e1c0f1d2cf0beeb5?s=80&amp;d=monsterid&amp;r=g"/>
              </a>
              <br/>
              <a class="bbp-author-name" href="http://cos.name/cn/profile/13526/" rel="nofollow" title="查看cloud wei的档案">
               cloud wei
              </a>
              <br/>
              <div class="bbp-author-role">
               版主
              </div>
             </div>
             <!-- .bbp-reply-author -->
             <div class="bbp-reply-content">
              <p>
               回复 第5楼 的 angel_man：上传到别的地方，放 环境中。
              </p>
              <p>
               整理下上主站吧！
              </p>
             </div>
             <!-- .bbp-reply-content -->
            </div>
            <!-- .reply -->
            <div class="bbp-reply-header" id="post-394860">
             <div class="bbp-meta">
              <span class="bbp-reply-post-date">
               2014年2月16日 上午4:41
              </span>
              <a class="bbp-reply-permalink" href="http://cos.name/cn/topic/150580/#post-394860">
               7 楼
              </a>
              <span class="bbp-admin-links">
              </span>
             </div>
             <!-- .bbp-meta -->
            </div>
            <!-- #post-394860 -->
            <div class="odd bbp-parent-forum-999 bbp-parent-topic-150580 bbp-reply-position-7 user-id-378520 post-394860 reply type-reply status-publish hentry">
             <div class="bbp-reply-author">
              <a class="bbp-author-avatar" href="http://cos.name/cn/profile/378520/" rel="nofollow" title="查看PuddingNnn的档案">
               <img src="http://sdn.geekzu.org/avatar/436174399b7aaeb22c666bc623015a5c?s=80&amp;d=monsterid&amp;r=g"/>
              </a>
              <br/>
              <a class="bbp-author-name" href="http://cos.name/cn/profile/378520/" rel="nofollow" title="查看PuddingNnn的档案">
               PuddingNnn
              </a>
              <br/>
              <div class="bbp-author-role">
               普通会员
              </div>
             </div>
             <!-- .bbp-reply-author -->
             <div class="bbp-reply-content">
              <p>
               这位少侠很有料！！ 可惜最后的分布和聚类无图无真相啊！
               <br/>
               少侠可以略作修改整理一下投稿到cos主站：editor@cos.name
               <br/>
               word或md形式皆可 ^_________^
              </p>
             </div>
             <!-- .bbp-reply-content -->
            </div>
            <!-- .reply -->
            <div class="bbp-reply-header" id="post-394872">
             <div class="bbp-meta">
              <span class="bbp-reply-post-date">
               2014年2月16日 下午2:04
              </span>
              <a class="bbp-reply-permalink" href="http://cos.name/cn/topic/150580/#post-394872">
               8 楼
              </a>
              <span class="bbp-admin-links">
              </span>
             </div>
             <!-- .bbp-meta -->
            </div>
            <!-- #post-394872 -->
            <div class="even bbp-parent-forum-999 bbp-parent-topic-150580 bbp-reply-position-8 user-id-384036 topic-author post-394872 reply type-reply status-publish hentry">
             <div class="bbp-reply-author">
              <a class="bbp-author-avatar" href="http://cos.name/cn/profile/384036/" rel="nofollow" title="查看野蛮人的档案">
               <img src="http://sdn.geekzu.org/avatar/133345d351988b5794ec0c88a6d6565e?s=80&amp;d=monsterid&amp;r=g"/>
              </a>
              <br/>
              <a class="bbp-author-name" href="http://cos.name/cn/profile/384036/" rel="nofollow" title="查看野蛮人的档案">
               野蛮人
              </a>
              <br/>
              <div class="bbp-author-role">
               普通会员
              </div>
             </div>
             <!-- .bbp-reply-author -->
             <div class="bbp-reply-content">
              <p>
               回复 第7楼 的 PuddingNnn：回复 第6楼 的 cloud wei：多谢厚爱，右图滴，只是不知道如何贴，上主站就不必了，欢迎交流
              </p>
             </div>
             <!-- .bbp-reply-content -->
            </div>
            <!-- .reply -->
            <div class="bbp-reply-header" id="post-394930">
             <div class="bbp-meta">
              <span class="bbp-reply-post-date">
               2014年2月17日 上午7:55
              </span>
              <a class="bbp-reply-permalink" href="http://cos.name/cn/topic/150580/#post-394930">
               9 楼
              </a>
              <span class="bbp-admin-links">
              </span>
             </div>
             <!-- .bbp-meta -->
            </div>
            <!-- #post-394930 -->
            <div class="odd bbp-parent-forum-999 bbp-parent-topic-150580 bbp-reply-position-9 user-id-82234 post-394930 reply type-reply status-publish hentry">
             <div class="bbp-reply-author">
              <a class="bbp-author-avatar" href="http://cos.name/cn/profile/82234/" rel="nofollow" title="查看bigknife的档案">
               <img src="http://sdn.geekzu.org/avatar/2d96292d60000df78116dd2e7169da19?s=80&amp;d=monsterid&amp;r=g"/>
              </a>
              <br/>
              <a class="bbp-author-name" href="http://cos.name/cn/profile/82234/" rel="nofollow" title="查看bigknife的档案">
               bigknife
              </a>
              <br/>
              <div class="bbp-author-role">
               普通会员
              </div>
             </div>
             <!-- .bbp-reply-author -->
             <div class="bbp-reply-content">
              <p>
               回复 第8楼 的 angel_man：不要谦虚啦，文章整理整理，图也贴上，发给我们，上主站吧哈。[s:11]
              </p>
             </div>
             <!-- .bbp-reply-content -->
            </div>
            <!-- .reply -->
            <div class="bbp-reply-header" id="post-395280">
             <div class="bbp-meta">
              <span class="bbp-reply-post-date">
               2014年2月20日 上午2:46
              </span>
              <a class="bbp-reply-permalink" href="http://cos.name/cn/topic/150580/#post-395280">
               10 楼
              </a>
              <span class="bbp-admin-links">
              </span>
             </div>
             <!-- .bbp-meta -->
            </div>
            <!-- #post-395280 -->
            <div class="even bbp-parent-forum-999 bbp-parent-topic-150580 bbp-reply-position-10 user-id-380298 post-395280 reply type-reply status-publish hentry">
             <div class="bbp-reply-author">
              <a class="bbp-author-avatar" href="http://cos.name/cn/profile/380298/" rel="nofollow" title="查看mrkkk的档案">
               <img src="http://sdn.geekzu.org/avatar/f21adf59100199587d2468eb2d1c7052?s=80&amp;d=monsterid&amp;r=g"/>
              </a>
              <br/>
              <a class="bbp-author-name" href="http://cos.name/cn/profile/380298/" rel="nofollow" title="查看mrkkk的档案">
               mrkkk
              </a>
              <br/>
              <div class="bbp-author-role">
               普通会员
              </div>
             </div>
             <!-- .bbp-reply-author -->
             <div class="bbp-reply-content">
              <p>
               哈，挺有意思的分析，涨姿势了，THX楼主
              </p>
             </div>
             <!-- .bbp-reply-content -->
            </div>
            <!-- .reply -->
            <div class="bbp-reply-header" id="post-398487">
             <div class="bbp-meta">
              <span class="bbp-reply-post-date">
               2014年3月26日 上午2:52
              </span>
              <a class="bbp-reply-permalink" href="http://cos.name/cn/topic/150580/#post-398487">
               11 楼
              </a>
              <span class="bbp-admin-links">
              </span>
             </div>
             <!-- .bbp-meta -->
            </div>
            <!-- #post-398487 -->
            <div class="odd bbp-parent-forum-999 bbp-parent-topic-150580 bbp-reply-position-11 user-id-108198 post-398487 reply type-reply status-publish hentry">
             <div class="bbp-reply-author">
              <a class="bbp-author-avatar" href="http://cos.name/cn/profile/108198/" rel="nofollow" title="查看causu的档案">
               <img src="http://sdn.geekzu.org/avatar/2e292bc2bb266ba7b4f60ada86fb2738?s=80&amp;d=monsterid&amp;r=g"/>
              </a>
              <br/>
              <a class="bbp-author-name" href="http://cos.name/cn/profile/108198/" rel="nofollow" title="查看causu的档案">
               causu
              </a>
              <br/>
              <div class="bbp-author-role">
               普通会员
              </div>
             </div>
             <!-- .bbp-reply-author -->
             <div class="bbp-reply-content">
              <p>
               期待楼主的文章早日上COS主站啊。。。
              </p>
             </div>
             <!-- .bbp-reply-content -->
            </div>
            <!-- .reply -->
            <div class="bbp-reply-header" id="post-398556">
             <div class="bbp-meta">
              <span class="bbp-reply-post-date">
               2014年3月26日 下午5:22
              </span>
              <a class="bbp-reply-permalink" href="http://cos.name/cn/topic/150580/#post-398556">
               12 楼
              </a>
              <span class="bbp-admin-links">
              </span>
             </div>
             <!-- .bbp-meta -->
            </div>
            <!-- #post-398556 -->
            <div class="even bbp-parent-forum-999 bbp-parent-topic-150580 bbp-reply-position-12 user-id-63771 post-398556 reply type-reply status-publish hentry">
             <div class="bbp-reply-author">
              <a class="bbp-author-avatar" href="http://cos.name/cn/profile/63771/" rel="nofollow" title="查看enthumelon的档案">
               <img src="http://sdn.geekzu.org/avatar/23e1a080e5b4e8dd18f14d65d651f38d?s=80&amp;d=monsterid&amp;r=g"/>
              </a>
              <br/>
              <a class="bbp-author-name" href="http://cos.name/cn/profile/63771/" rel="nofollow" title="查看enthumelon的档案">
               enthumelon
              </a>
              <br/>
              <div class="bbp-author-role">
               普通会员
              </div>
             </div>
             <!-- .bbp-reply-author -->
             <div class="bbp-reply-content">
              <p>
               现在twitter的数据不是只是随机给的（天知道是不是随机的）一部分么？
              </p>
             </div>
             <!-- .bbp-reply-content -->
            </div>
            <!-- .reply -->
            <div class="bbp-reply-header" id="post-398832">
             <div class="bbp-meta">
              <span class="bbp-reply-post-date">
               2014年3月28日 下午3:50
              </span>
              <a class="bbp-reply-permalink" href="http://cos.name/cn/topic/150580/#post-398832">
               13 楼
              </a>
              <span class="bbp-admin-links">
              </span>
             </div>
             <!-- .bbp-meta -->
            </div>
            <!-- #post-398832 -->
            <div class="odd bbp-parent-forum-999 bbp-parent-topic-150580 bbp-reply-position-13 user-id-383998 post-398832 reply type-reply status-publish hentry">
             <div class="bbp-reply-author">
              <a class="bbp-author-avatar" href="http://cos.name/cn/profile/383998/" rel="nofollow" title="查看mit1987的档案">
               <img src="http://sdn.geekzu.org/avatar/8743f983c02cd4f7a90aa954abfe7888?s=80&amp;d=monsterid&amp;r=g"/>
              </a>
              <br/>
              <a class="bbp-author-name" href="http://cos.name/cn/profile/383998/" rel="nofollow" title="查看mit1987的档案">
               mit1987
              </a>
              <br/>
              <div class="bbp-author-role">
               普通会员
              </div>
             </div>
             <!-- .bbp-reply-author -->
             <div class="bbp-reply-content">
              <p>
               楼主有没有兴趣一起写篇行为金融学的论文, 看了你的帖子, 我有个想法,或许可行
              </p>
             </div>
             <!-- .bbp-reply-content -->
            </div>
            <!-- .reply -->
            <div class="bbp-reply-header" id="post-398985">
             <div class="bbp-meta">
              <span class="bbp-reply-post-date">
               2014年3月31日 上午3:15
              </span>
              <a class="bbp-reply-permalink" href="http://cos.name/cn/topic/150580/#post-398985">
               14 楼
              </a>
              <span class="bbp-admin-links">
              </span>
             </div>
             <!-- .bbp-meta -->
            </div>
            <!-- #post-398985 -->
            <div class="even bbp-parent-forum-999 bbp-parent-topic-150580 bbp-reply-position-14 user-id-371848 post-398985 reply type-reply status-publish hentry">
             <div class="bbp-reply-author">
              <a class="bbp-author-avatar" href="http://cos.name/cn/profile/371848/" rel="nofollow" title="查看paradoxbirdy的档案">
               <img src="http://sdn.geekzu.org/avatar/3beaaa7edd8c71da8195e8443d12f9c1?s=80&amp;d=monsterid&amp;r=g"/>
              </a>
              <br/>
              <a class="bbp-author-name" href="http://cos.name/cn/profile/371848/" rel="nofollow" title="查看paradoxbirdy的档案">
               paradoxbirdy
              </a>
              <br/>
              <div class="bbp-author-role">
               普通会员
              </div>
             </div>
             <!-- .bbp-reply-author -->
             <div class="bbp-reply-content">
              <p>
               挺有意思[s:18]
              </p>
              <div class="bbp-signature">
               <p>
                若有所思，若有所痴，若有所失。
               </p>
              </div>
             </div>
             <!-- .bbp-reply-content -->
            </div>
            <!-- .reply -->
            <div class="bbp-reply-header" id="post-399823">
             <div class="bbp-meta">
              <span class="bbp-reply-post-date">
               2014年4月10日 下午7:26
              </span>
              <a class="bbp-reply-permalink" href="http://cos.name/cn/topic/150580/#post-399823">
               15 楼
              </a>
              <span class="bbp-admin-links">
              </span>
             </div>
             <!-- .bbp-meta -->
            </div>
            <!-- #post-399823 -->
            <div class="odd bbp-parent-forum-999 bbp-parent-topic-150580 bbp-reply-position-15 user-id-386060 post-399823 reply type-reply status-publish hentry">
             <div class="bbp-reply-author">
              <a class="bbp-author-avatar" href="http://cos.name/cn/profile/386060/" rel="nofollow" title="查看lycoris的档案">
               <img src="http://sdn.geekzu.org/avatar/011bfc19f6298e597a0a04f9bab1aca3?s=80&amp;d=monsterid&amp;r=g"/>
              </a>
              <br/>
              <a class="bbp-author-name" href="http://cos.name/cn/profile/386060/" rel="nofollow" title="查看lycoris的档案">
               lycoris
              </a>
              <br/>
              <div class="bbp-author-role">
               普通会员
              </div>
             </div>
             <!-- .bbp-reply-author -->
             <div class="bbp-reply-content">
              <p>
               楼主你是怎么样获取的wildfire的账户的啊？我想用twitteR但是没有账户无法获得授权呢
              </p>
             </div>
             <!-- .bbp-reply-content -->
            </div>
            <!-- .reply -->
           </li>
           <!-- .bbp-body -->
           <li class="bbp-footer">
            <div class="bbp-reply-author">
             作者
            </div>
            <div class="bbp-reply-content">
             帖子
            </div>
            <!-- .bbp-reply-content -->
           </li>
           <!-- .bbp-footer -->
          </ul>
          <!-- #topic-150580-replies -->
          <div class="bbp-pagination">
           <div class="bbp-pagination-count">
            查看 15 个帖子 - 1 到 15（总计 17 个）
           </div>
           <div class="bbp-pagination-links">
            <span class="page-numbers current">
             1
            </span>
            <a class="page-numbers" href="http://cos.name/cn/topic/150580/page/2/">
             2
            </a>
            <a class="next page-numbers" href="http://cos.name/cn/topic/150580/page/2/">
             →
            </a>
           </div>
          </div>
          <div class="bbp-no-reply" id="no-reply-150580">
           <div class="bbp-template-notice">
            <p>
             您必须先登录才能回复该主题。
            </p>
           </div>
          </div>
         </div>
        </div>
        <!-- .entry-content -->
        <footer class="entry-meta">
        </footer>
        <!-- .entry-meta -->
       </article>
       <!-- #post -->
       <div class="comments-area" id="comments">
       </div>
       <!-- #comments -->
      </div>
      <!-- #content -->
     </div>
     <!-- #primary -->
     <div class="sidebar-container" id="tertiary" role="complementary">
      <div class="sidebar-inner">
       <div class="widget-area">
        <aside class="widget bbp_widget_login" id="bbp_login_widget-2">
         <h3 class="widget-title">
          登录
         </h3>
         <form action="http://cos.name/cn/wp-login.php" class="bbp-login-form" method="post">
          <fieldset>
           <legend>
            登录
           </legend>
           <div class="bbp-username">
            <label for="user_login">
             用户名:
            </label>
           </div>
           <div class="bbp-password">
            <label for="user_pass">
             密码:
            </label>
           </div>
           <div class="bbp-remember-me">
            <label for="rememberme">
             记住用户名
            </label>
           </div>
           <div class="bbp-submit-wrapper">
            <button class="button submit user-submit" id="user-submit" name="user-submit" tabindex="104" type="submit">
             登录
            </button>
           </div>
           <div class="bbp-login-links">
            <a class="bbp-register-link" href="http://cos.name/cn/wp-login.php?action=register" title="注册">
             注册
            </a>
            <a class="bbp-lostpass-link" href="http://cos.name/cn/wp-login.php?action=lostpassword" title="忘记密码">
             忘记密码
            </a>
           </div>
          </fieldset>
         </form>
        </aside>
        <aside class="widget widget_text" id="text-7">
         <h3 class="widget-title">
          搜索
         </h3>
         <div class="textwidget">
          <form action="http://www.google.com/search" id="bbp-search-form" method="get" onsubmit="Gsitesearch(this)" role="search">
           <div>
           </div>
          </form>
          <form id="bbp-search-form-baidu" onsubmit="g(this)" role="search">
           <div>
           </div>
          </form>
         </div>
        </aside>
        <aside class="widget widget_text" id="text-2">
         <h3 class="widget-title">
          新鲜事
         </h3>
         <div class="textwidget">
          <ul>
           <li>
            <a href="http://cos.name/cn/topics/">
             最新帖子
            </a>
           </li>
           <li>
            <a href="http://cos.name/cn/view/popular/">
             最热门主题
            </a>
           </li>
           <li>
            <a href="http://cos.name/cn/view/no-replies/">
             消灭零回复
            </a>
           </li>
          </ul>
         </div>
        </aside>
        <aside class="widget widget_text" id="text-3">
         <h3 class="widget-title">
          RSS订阅
         </h3>
         <div class="textwidget">
          <ul>
           <li>
            <img src="http://cos.name/wp-includes/images/rss.png"/>
            <a href="http://cos.name/cn/topics/feed/">
             所有主题
            </a>
           </li>
           <li>
            <img src="http://cos.name/wp-includes/images/rss.png"/>
            <a href="http://cos.name/cn/forums/feed/">
             所有帖子
            </a>
           </li>
          </ul>
         </div>
        </aside>
       </div>
       <!-- .widget-area -->
      </div>
      <!-- .sidebar-inner -->
     </div>
     <!-- #tertiary -->
    </div>
    <!-- #main -->
    <footer class="site-footer" id="colophon" role="contentinfo">
     <div class="site-info">
      版权所有 © 2014 统计之都 | 由
      <a href="http://wordpress.org/">
       WordPress
      </a>
      构建 | 主题修改自
      <a href="http://wordpress.org/themes/twentythirteen">
       Twenty Thirteen
      </a>
     </div>
     <!-- .site-info -->
    </footer>
    <!-- #colophon -->
   </div>
   <!-- #page -->
  </div>
 </body>
</html>